package com.ruoyi.walmart.service.order.impl;

import com.ruoyi.walmart.domain.order.OrderItem;
import com.ruoyi.walmart.domain.QuerySummary;
import com.ruoyi.walmart.mapper.order.OrderItemMapper;
import com.ruoyi.walmart.service.order.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderItemServiceImpl implements OrderItemService {

    @Autowired
    OrderItemMapper orderItemMapper;

    @Override
    public int insertAll(List<OrderItem> orderItemList) {
        return orderItemMapper.insertAll(orderItemList);
    }

    @Override
    public int deleteItem(List<String> customerOrderIds) {
        return orderItemMapper.deleteItem(customerOrderIds);
    }

    @Override
    public List<OrderItem> selectAllByCustomerOrderId(String customerOrderId,Long authId,String purchaseOrderId) {
        return orderItemMapper.selectAllByCustomerOrderId(customerOrderId,authId,purchaseOrderId);
    }

    /**
     * 汇总订单列表
     * @return
     */
    @Override
    public QuerySummary getOrderSummary(QuerySummary orderSummary) {
        return orderItemMapper.getOrderSummary(orderSummary);
    }

    /** 更新订单明细状态 */
    @Override
    public int updateOrderStatusBatch(List<OrderItem> orderItemList) {
        return orderItemMapper.updateOrderStatusBatch(orderItemList);
    }

    /** 查询是否存在对应的walmarItems */
    @Override
    public List<String> findExistingItemPurchaseOrderIds(List<String> purchaseOrderIds) {
        return orderItemMapper.findExistingItemPurchaseOrderIds(purchaseOrderIds);
    }
}
